package avicit.bdp.dms.tdm.rest;

import avicit.bdp.dms.tdm.dto.ApiSettingDTO;
import avicit.bdp.dms.tdm.service.ApiSettingService;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Api(tags = "资产api设置接口")
@RequestMapping("/api/bdp/dms/asset/apiSetting")
public class ApiSettingRest {
    private static final Logger logger = LoggerFactory.getLogger(ApiSettingRest.class);

    @Autowired
    private ApiSettingService apiSettingService;
    @ApiOperation(value = "保存设置")
    @PostMapping("/save")
    public ResponseMsg<ApiSettingDTO> save(@RequestBody ApiSettingDTO dto) {
        ResponseMsg<ApiSettingDTO> responseMsg = new ResponseMsg<>();
        apiSettingService.save(dto);
        return responseMsg;
    }

    @ApiOperation(value = "查询api设置")
    @ApiParam(value = "assetId", name = "assetId", required = true)
    @GetMapping("/queryByAssetId")
    public ResponseMsg<ApiSettingDTO> queryApplyButton(@RequestParam String assetId) {
        ResponseMsg<ApiSettingDTO> responseMsg = new ResponseMsg<>();
        responseMsg.setResponseBody(apiSettingService.queryByAssetId(assetId));
        return responseMsg;
    }

}
